import Vue from 'vue'

import {
  Button,
  Icon,
  NavBar,
  Form,
  Field,
  Toast,
  Tabbar,
  TabbarItem,
  Image as VanImage,
  Col,
  Row,
  Cell,
  CellGroup,
  Dialog,
  Tab,
  Tabs,
  List,
  Grid,
  GridItem,
  PullRefresh,
  Lazyload,
  Popup,
  ActionSheet,
  Search,
  Swipe,
  SwipeItem,
  NoticeBar,
  Tag,
  DatetimePicker,
  Picker,
  Uploader,
  Empty,
  ImagePreview,
  Divider
} from 'vant'

const vantComponentPool = [
  Button,
  Icon,
  NavBar,
  Form,
  Field,
  Toast,
  Tabbar,
  TabbarItem,
  VanImage,
  Tag,
  Col,
  Row,
  Cell,
  CellGroup,
  Dialog,
  Tab,
  Tabs,
  List,
  Grid,
  GridItem,
  PullRefresh,
  Lazyload,
  Popup,
  ActionSheet,
  Search,
  Swipe,
  SwipeItem,
  NoticeBar,
  DatetimePicker,
  Picker,
  Uploader,
  Empty,
  ImagePreview,
  Divider
]

vantComponentPool.forEach((component) => {
  if (component.name === 'ImagePreview') {
    Vue.prototype.$ImagePreview = ImagePreview
  }
  Vue.use(component)
})
